/**
 * 
 */
package com.google.code.netz.wfe.events;

import static com.google.code.netz.wfe.events.TransitionEvent.TransitionEventType.TRANSITION_COMPLETED;
import static com.google.code.netz.wfe.events.TransitionEvent.TransitionEventType.TRANSITION_DISABLED;
import static com.google.code.netz.wfe.events.TransitionEvent.TransitionEventType.TRANSITION_ENABLED;
import static com.google.code.netz.wfe.events.TransitionEvent.TransitionEventType.TRANSITION_FIRED;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.google.code.netz.wfe.model.Transition;

/**
 * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
 * @since 1.0
 * @version $Id$
 */
public class TransitionEventListener implements ITypedEventListener<TransitionEvent<Transition<?>>> {

	/**
	 * Commons logging.
	 */
	private static Log log = LogFactory.getLog(TransitionEvent.class);

	/**
	 * {@inheritDoc}
	 * 
	 * @see com.google.code.netz.wfe.events.ITypedEventListener#onEvent(com.google.code.netz.wfe.events.TypedEvent)
	 */
	public void onEvent(TransitionEvent<Transition<?>> event) {
		// Transition source = event.getSource();
		if (event.getType() == TRANSITION_FIRED) {
			handledTransitionFiredEvent(event);
		} else if (event.getType() == TRANSITION_COMPLETED) {
			handledTransitionCompletedEvent(event);
		} else if (event.getType() == TRANSITION_ENABLED) {
			handledTransitionEnableEvent(event);
		} else if (event.getType() == TRANSITION_DISABLED) {
			handleTransitionDisabledEvent(event);
		}
	}

	/**
	 * 
	 * @param event
	 */
	private void handleTransitionDisabledEvent(TransitionEvent<Transition<?>> event) {
		// TODO Auto-generated method stub

		log.info("Handling event: " + event.getType().asString());
	}

	/**
	 * 
	 * @param event
	 */
	private void handledTransitionEnableEvent(TransitionEvent<?> event) {
		// TODO Auto-generated method stub
		log.info("Handling event: " + event.getType().asString());
	}

	/**
	 * 
	 * @param event
	 */
	private void handledTransitionCompletedEvent(TransitionEvent<?> event) {
		// TODO Auto-generated method stub
		log.info("Handling event: " + event.getType().asString());
	}

	/**
	 * 
	 * @param event
	 */
	private void handledTransitionFiredEvent(TransitionEvent<?> event) {
		// TODO Auto-generated method stub
		log.info("Handling event: " + event.getType().asString());
	}

}
